#include "RotationNode.h"

RotationNode::RotationNode(void)
{
}

RotationNode::RotationNode(D3DXVECTOR3* axis, float angle) : axisMode(true)
{
	pvAxis = axis;
	fAngle = angle;
}

RotationNode::RotationNode(float yaw, float pitch, float roll) : axisMode(false) 
{
	fYaw = yaw;
	fPitch = pitch;
	fRoll = roll;
}

void RotationNode::setYPR(float yaw, float pitch, float roll) 
{
	axisMode = false;
	fYaw = yaw;
	fPitch = pitch;
	fRoll = roll;
}

float RotationNode::getYaw() {
	return fYaw;
}

float RotationNode::getPitch() {
	return fPitch;
}

float RotationNode::getRoll() {
	return fRoll;
}

RotationNode::~RotationNode(void)
{
}

void RotationNode::Transform(LPD3DXMATRIXSTACK mStack)
{
	if (axisMode == true) {
		mStack->RotateAxisLocal(pvAxis, fAngle);
	}
	else {
		mStack->RotateYawPitchRollLocal(fYaw,fPitch,fRoll);
	}
}